
from S3D import Tokenizer as _tkn
from S3D import Parser as _parser
from S3D.PS import Parser as _ps_parser
from S3D.PS import Section as _sect

ParserError     = _parser.ParserError
TokenizerError  = _tkn.TokenizerError
PSSection       = _sect.PSSection
PSParser        = _ps_parser.PSParser

def parseFile(filename):
    with open(filename, "r") as f:
        text = f.read()

        parser = PSParser()
        return parser.compile(text, filename)

def parseString(text, info="<string>"):
    parser = PSParser()
    return parser.compile(text, info)